$(function (){
    $("#btmSubmit").click(function(){
        validar();
        return false;
    });
    
    $(document).ready(function() {
        $(".username").focus(function() {
            $(".user-icon").css("left","-48px");
        });
        $(".username").blur(function() {
            $(".user-icon").css("left","0px");
        });
        $(".password").focus(function() {
            $(".pass-icon").css("left","-48px");
        });
        $(".password").blur(function() {
            $(".pass-icon").css("left","0px");
        });
    });
    $("#username").focus();
});
var validar = function(){
    var login = {
        opc:"log",
        user:$("#username").val(),
        pass:$("#password").val()
    };
    $.ajax({
        data:login,
        url:'ajax/ajaxLogin.php',
        type:'post',
        beforeSend:function(){},
        success:function(response){
            if(response==="OK"){
                document.location.href="index.php";
                $("#result").html("Bienvenido al Sistema");
            }else{
                $("#result").html(response);
            }
        }
    });
};